Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TabView.ItemChanged Event Fix #8420

Merged
merged 9 commits into from
Apr 25, 2023
Merged

Conversation

karkarl
Copy link
Contributor

@karkarl karkarl commented Apr 20, 2023

Description

https://github.com/microsoft/microsoft-ui-xaml/blob/main/dev/TabView/TabView.cpp#L725
From #6632 to fix internal bug 37608918 caused a regression where TabView.ItemChanged event is simply not raised.

Upon investigation, normally, OnItemsChanged is raised twice when dragged past the overflow scroll buttons:

  1. CollectionChanged::ItemRemoved - Dragged item being removed since it's "overflow"
  2. CollectionChanged::ItemInserted - Dragged item being dropped back in

Since TabView thinks the tab is being removed, it finds the closest tab to give selection: https://github.com/microsoft/microsoft-ui-xaml/blob/main/dev/TabView/TabView.cpp#L764

Fix:
Remove the m_isDragging check and simply call BringSelectedTabIntoView() OnListViewDragItemsCompleted for the original bug fix.

Removing the m_isDragging check also prevents a regression where a tab is being dragged to another window, causing no tab to be selected.

(This is a regression)
image

Motivation and Context

Fixes internal bug 44190134

How Has This Been Tested?

Added new test ItemChangedEventOnDragTest to avoid regression where ItemChanged Event is not called.

Screenshots (if appropriate):

@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Apr 20, 2023
@karkarl karkarl requested a review from ojhad April 20, 2023 23:30
@karkarl
Copy link
Contributor Author

karkarl commented Apr 22, 2023

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

// TODO 19727004: Re-enable this on versions below RS5 after fixing the bug where mouse click-and-drag doesn't work.
Log.Warning("This test relies on touch input, the injection of which is only supported in RS5 and up. Test is disabled.");
return;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can actually remove this, since we no longer run tests lower than RS5.

Copy link
Member

@kmahone kmahone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@karkarl
Copy link
Contributor Author

karkarl commented Apr 25, 2023

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@karkarl
Copy link
Contributor Author

karkarl commented Apr 25, 2023

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@karkarl
Copy link
Contributor Author

karkarl commented Apr 25, 2023

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@karkarl karkarl merged commit c8d3b4a into main Apr 25, 2023
@karkarl karkarl deleted the user/karkarl/TabViewItemChangedFix branch April 25, 2023 19:24
bkudiess pushed a commit that referenced this pull request May 1, 2023
* re-enable OnItemsChanged OnDrag

* update testPage

* add test

* undo accidental change

* fix test

* add test

* remove outdated check

* fix test

* fix test

(cherry picked from commit c8d3b4a)
DHowett pushed a commit to microsoft/terminal that referenced this pull request May 10, 2023
Reverts #15164, because that's fixed upstream now.

Closes #15139. 

Reverts #15178, but also closes #15121, because that's fixed upstream.

see also:
* microsoft/microsoft-ui-xaml#8430
* microsoft/microsoft-ui-xaml#8420
@bpulliam bpulliam removed the needs-triage Issue needs to be triaged by the area owners label Jun 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants